﻿using Coolzon.UI.Core;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using Visifire.Gauges;

namespace Coolzon.UI.Charts
{
    public partial class DataGaugeBase
    {
        protected Visifire.Gauges.Gauge SetGauge(Visifire.Gauges.Gauge gauge)
        {
            //gauge.BorderBrush = Brushes.Red;// GaugeBorderBrush == null ? null : GaugeBorderBrush;
            gauge.BorderThickness = new Thickness(0);// GaugeBorderThickness;
            gauge.Background = null;// this.Background;// Brushes.Blue;//GaugeBackground==null? null : GaugeBackground;
            if (GaugeBackFrameThickness != null)
                gauge.BackFrameThickness = GaugeBackFrameThickness.Value;
          //  gauge.DefaultTemplate = GaugeDefaultTemplate;
            // 整体背景
            gauge.FrameBackground = null;// this.Background; //GaugeFrameBackground == null ? null : GaugeFrameBackground;
            gauge.OuterBackground = Brushes.Transparent;// GaugeOuterBackground == null ? null : GaugeOuterBackground;
            gauge.OuterBorderThickness = new Thickness(0);// GaugeOuterBorderThickness;
            //gauge.OuterBorderBrush = Brushes.Red;// GaugeOuterBorderBrush == null ? null : GaugeOuterBorderBrush;
            gauge.ShadowEnabled = false;// GaugeShadowEnabled;
            gauge.ToolTipText = GaugeToolTipText;
            //gauge.DefaultTemplate = GaugeDefaultTemplate;

            return gauge;
        }

        private Brush gaugeBorderBrush;
        private Thickness gaugeBorderThickness;
        private Brush gaugeBackground;
        private double? gaugeBackFrameThickness;
        private DefaultTemplates gaugeDefaultTemplate;
        private Brush gaugeFrameBackground;
        private Brush gaugeOuterBackground;
        private Thickness gaugeOuterBorderThickness;
        private Brush gaugeOuterBorderBrush;
        private bool gaugeShadowEnabled;
        private Visifire.Gauges.GaugeTypes gaugeType;
        private string gaugeToolTipText;

        [Category("仪表盘")]
        [DisplayName("仪表盘边框颜色")]
        [Description("GaugeBorderBrush")]
        //[Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "GaugeBorderBrush", "仪表盘边框颜色")]
        public Brush GaugeBorderBrush
        {
            get
            {
                return gaugeBorderBrush;
            }

            set
            {
                gaugeBorderBrush = value;
                //Refresh();
            }
        }

        [Category("仪表盘")]
        [DisplayName("仪表盘边框大小")]
        [Description("GaugeBorderThickness")]
        //[Editor(typeof(UI.XProperty.Editors.XThicknessEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "GaugeBorderThickness", "仪表盘边框大小")]
        public Thickness GaugeBorderThickness
        {
            get
            {
                return gaugeBorderThickness;
            }

            set
            {
                gaugeBorderThickness = value;
                //Refresh();
            }
        }

        [Category("仪表盘")]
        [DisplayName("仪表盘背景颜色")]
        [Description("GaugeBackground")]
        //[Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "GaugeBackground", "仪表盘背景颜色")]
        public Brush GaugeBackground
        {
            get
            {
                return gaugeBackground;
            }

            set
            {
                gaugeBackground = value;
                //Refresh();
            }
        }

        [Category("仪表盘")]
        [DisplayName("仪表盘框架大小")]
        [Description("GaugeBackFrameThickness")]
        //[Editor(typeof(UI.XProperty.Editors.XDoubleNullEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "GaugeBackFrameThickness", "仪表盘框架大小")]
        public double? GaugeBackFrameThickness
        {
            get
            {
                return gaugeBackFrameThickness;
            }

            set
            {
                gaugeBackFrameThickness = value;
                //Refresh();
            }
        }

        [Category("仪表盘")]
        [DisplayName("仪表盘默认模板")]
        [Description("GaugeDefaultTemplate")]
        //[Editor(typeof(UI.DataPartLib.XProperty.Editors.XDefaultTemplatesEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "GaugeDefaultTemplate", "仪表盘默认模板")]
        public DefaultTemplates GaugeDefaultTemplate
        {
            get
            {
                return gaugeDefaultTemplate;
            }

            set
            {
                gaugeDefaultTemplate = value;
                //Refresh();
            }
        }

        [Category("仪表盘")]
        [DisplayName("仪表盘框架颜色")]
        [Description("GaugeFrameBackground")]
        //[Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "GaugeFrameBackground", "仪表盘框架颜色")]
        public Brush GaugeFrameBackground
        {
            get
            {
                return gaugeFrameBackground;
            }

            set
            {
                gaugeFrameBackground = value;
                //Refresh();
            }
        }

        [Category("仪表盘")]
        [DisplayName("仪表盘外框背景颜色")]
        [Description("GaugeOuterBackground")]
        //[Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "GaugeOuterBackground", "仪表盘外框背景颜色")]
        public Brush GaugeOuterBackground
        {
            get
            {
                return gaugeOuterBackground;
            }

            set
            {
                gaugeOuterBackground = value;
                //Refresh();
            }
        }

        [Category("仪表盘")]
        [DisplayName("仪表盘外框边框大小")]
        [Description("GaugeOuterBorderThickness")]
        //[Editor(typeof(UI.XProperty.Editors.XThicknessEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "GaugeOuterBorderThickness", "仪表盘外框边框大小")]
        public Thickness GaugeOuterBorderThickness
        {
            get
            {
                return gaugeOuterBorderThickness;
            }

            set
            {
                gaugeOuterBorderThickness = value;
                //Refresh();
            }
        }

        [Category("仪表盘")]
        [DisplayName("仪表盘外框边框颜色")]
        [Description("GaugeOuterBorderBrush")]
        //[Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "GaugeOuterBorderBrush", "仪表盘外框边框颜色")]
        public Brush GaugeOuterBorderBrush
        {
            get
            {
                return gaugeOuterBorderBrush;
            }

            set
            {
                gaugeOuterBorderBrush = value;
                //Refresh();
            }
        }

        [Category("仪表盘")]
        [DisplayName("仪表盘是否显示阴影")]
        [Description("GaugeShadowEnabled")]
        //[Editor(typeof(UI.XProperty.Editors.XBooleanEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "GaugeShadowEnabled", "仪表盘是否显示阴影")]
        public bool GaugeShadowEnabled
        {
            get
            {
                return gaugeShadowEnabled;
            }

            set
            {
                gaugeShadowEnabled = value;
                //Refresh();
            }
        }

        public GaugeTypes GaugeType
        {
            get
            {
                return gaugeType;
            }

            set
            {
                gaugeType = value;
                //Refresh();
            }
        }

        [Category("仪表盘")]
        [DisplayName("仪表盘提示")]
        [Description("GaugeToolTipText")]
        //[Editor(typeof(UI.XProperty.Editors.XStringEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "GaugeToolTipText", "仪表盘提示")]
        public string GaugeToolTipText
        {
            get
            {
                return gaugeToolTipText;
            }

            set
            {
                gaugeToolTipText = value;
                //Refresh();
            }
        }
    }
}
